# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=yasuo
pkgver=121.994dcb1
pkgrel=12
groups=('blackarch' 'blackarch-webapp' 'blackarch-scanner')
pkgdesc='A ruby script that scans for vulnerable & exploitable 3rd-party web applications on a network.'
arch=('any')
url='https://github.com/0xsauby/yasuo'
depends=('ruby' 'ruby-bundler' 'ruby-pkg-config' 'libxslt')
makedepends=('git')
license=('GPL3')
source=("git+https://github.com/0xsauby/$pkgname.git")
sha512sums=('SKIP')
install="$pkgname.install"

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm README.md LICENSE

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec bundle exec ./$pkgname.rb "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

